<template>
	<yd-tabbar  :fixed=true>
        <yd-tabbar-item :title="item.title" :link="item.linkTo" v-for="(item,index) in tabbar" @click.native="tabbarTab(index)" :key="index" :active="item.active">
        	<!--<img slot="icon" src="../../assets/icon/footIco1.png" alt="" />-->
	        <img slot="icon" :src="item.activeImg" v-if="item.active">
	        <img slot="icon" :src="item.normalImg" v-else>
	    </yd-tabbar-item>
    </yd-tabbar>
</template>

<script>
	export default{
		data(){
			return{
				tabbar:this.$store.state.tabbar
			}
		},
		mounted(){
			for (var i = 0;i < this.tabbar.length;i++) {
				if (this.$store.state.tabbarIndex == i) {
					this.$store.state.tabbar[i].active = true;
				} else{
					this.$store.state.tabbar[i].active = false;
				}
			}
			
        },
		methods:{
			tabbarTab(index){
				this.$store.state.tabbarIndex = index;
			}
		}
		
	}
</script>

<style>
	.yd-tabbar{background-color: #ff5959 !important;height: 0.49rem;}
	.yd-tabbar-icon img{width: 0.3rem;height: 0.3rem;}
</style>